//
// Created by Administrator on 2025/9/4.
//

#include <iostream>
#include <map>
#include <string>

int main()
{
    std::map<std::string, size_t> word_count; // empty map from string to size_t
    std::string word;
    while (std::cin >> word)
        ++word_count[word];
    // get an iterator positioned on the first element
    auto map_it = word_count.cbegin();
    // compare the current iterator to the off-the-end iterator
    while (map_it != word_count.cend()) {
        // dereference the iterator to print the element key--value pairs
        std::cout << map_it->first << " occurs "
        << map_it->second << " times" << std::endl;
        ++map_it; // increment the iterator to denote the next element
    }
}
